<?php
class Portfolio extends SilkObjectRelationalMapping {
	public $table = 'portfolios';
	public function __construct(){
		parent::__construct();
	}
    
	public function setup() {
		$this->create_has_many_association( 'shouts', 'Shout', 'portfolio_id' );
		$this->create_belongs_to_association( 'user', 'mpUser', 'user_id' );
		$this->create_has_and_belongs_to_many_association(  'interests', 'Interest', 'interests_vs_portfolios', 'interest_id', 'portfolio_id', array( 'conditions'=> array('silk_interests_vs_portfolios.disposition = \'Y\'' ) ) );
		$this->create_has_and_belongs_to_many_association( "disinterests", "Interest", "interests_vs_portfolios", "interest_id", "portfolio_id", array( 'conditions'=>array( 'silk_interests_vs_portfolios.disposition = ?', 'N' ) ) );
		$this->create_has_one_association("experience", "Experience", "experience_id");
		$this->create_belongs_to_association("get_experience", "Experience", "experience_id");
	}
	
	public function get_experience() {
		$experience = orm("experience")->find_by_id($this->experience_id);
		if(isset($experience->params["name"])) {
			return $experience->params["name"];
		}
		return;
	}
}
?>